package Negocio;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.LinkedList;
import java.util.List;

import org.junit.Test;


public class FachadaSistemaTest {


	ISistema fachada ;
	Professor professor,professor2,professor3;


	@Test
	public void testCadastroDeProfessor(){

		fachada = new FachadaSistema();
		List<Professor> professores1;
		List<Professor> professores=fachada.ListarProfessorDepart();
		List<Disciplina> disc=fachada.ListarDisciplina();


		assertTrue(disc.size()==0);

		assertTrue(professores.size()==0);


		disc=fachada.ListarDisciplina();


		professor=new Professor();
		professor.setMatricula("111");
		professor.setNome("Ayla");

		professor2=new Professor();
		professor2.setMatricula("222");
		professor2.setNome("rodrigo");

		professor3=new Professor();
		professor3.setMatricula("333");
		professor3.setNome("Jessyca");

		professores1=new LinkedList<Professor>();
		professores1.add(professor);
		professores1.add(professor2);
		professores1.add(professor3);

		fachada.cadastrarDisciplina("ESA", "001", professores1);
		disc=fachada.ListarDisciplina();

		assertTrue(disc.size()==1);

		fachada.cadastraProf("Ayla","123");
		fachada.cadastraProf("jessica", "12345");
		assertEquals("Ayla"   ,fachada.ListarDisciplina().get(0).getProfessor().get(0).getNome     ());
		assertEquals("111"    ,fachada.ListarDisciplina().get(0).getProfessor().get(0).getMatricula());
		assertEquals("rodrigo",fachada.ListarDisciplina().get(0).getProfessor().get(1).getNome     ());
		assertEquals("222"    ,fachada.ListarDisciplina().get(0).getProfessor().get(1).getMatricula());
		assertEquals("Jessyca",fachada.ListarDisciplina().get(0).getProfessor().get(2).getNome     ());
		assertEquals("333"    ,fachada.ListarDisciplina().get(0).getProfessor().get(2).getMatricula());

		professores = fachada.ListarProfessorDepart();

		assertTrue(professores.size()==2);
		assertEquals("Ayla"   ,professores.get(0).getNome     ());
		assertEquals("123"    ,professores.get(0).getMatricula());
		assertEquals("jessica",professores.get(1).getNome     ());
		assertEquals("12345"  ,professores.get(1).getMatricula());








	}

}
